//定义一个关于user的store
import {defineStore} from 'pinia'

const useUser = defineStore("user",{
    state:()=>({
        name:"马小跳",
        age:18
    }),
    // 开启数据缓存
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'user',//设置存储的key
                storage: localStorage,//表示存储在localStorage
                // paths: ['id'],//指定要长久化的字段
            }
        ]
    }
})

export default useUser